<!-- 搜索 -->
<section class="admin_search_section" style='display:{eq name="searchConfig.openBox" value="true"}block{else /}none{/eq};'>
    <form action="/" method="POST" name="search">
    <ul class="ulColumn2">
        {volist name="searchConfig.searchKey" id="vo"}
            <li>
                <span class="item_name" style="width:120px;">{$vo.name}：</span>
                {switch name="vo.type"}
                {case value="input"}
                    <input name="{$key}" type="text" value="{$vo.value_default}" class="textbox textbox_295" maxlength="{$vo.text_max}" />
                {/case}
                {case value="radio"}
                    {volist name="vo.value" id="radio_name" key="k"}
                        <input type="radio" name="{:array_search($vo,$searchConfig['searchKey'])}" value="{$key}" id="checkbox_{:array_search($vo,$searchConfig['searchKey'])}{$k}" class="chk_5" {eq name="key" value="$vo.value_default"}checked="checked" {/eq} />
                        <label for="checkbox_{:array_search($vo,$searchConfig['searchKey'])}{$k}">{$radio_name}</label>
                    {/volist}
                {/case}
                {case value="select"}
                    <select class="select" name="{$key}">
                        {volist name="vo.value" id="select_item" key="k2"}
                            <option value="{$key}" {eq name="key" value="$vo.value_default"}selected="selected" {/eq}>{$select_item}</option>
                        {/volist}
                    </select>
                {/case}
                {default /}
                <input name="{$key}" type="text" value="{$vo.value}" class="textbox textbox_295" maxlength="{$vo.text_max}" />
                {/switch}
                {present name="vo.info"}<div class="tishi"><i class="iconfont iconfont-tishi"></i>{$vo.info}</div>{/present}
            </li>
        {/volist}
        <li>
            <span class="item_name" style="width:120px;"></span>
            <input type="submit" class="link_btn" value="搜索"/>
        </li>
    </ul>
    </form>
</section>
<script>
$(function(){
    var is_open = '{eq name="searchConfig.openBox" value="true"}1{else /}0{/eq}';
    $('.page_title h2').before('<a class="fr top_rt_btn iconfont iconfont-'+(is_open == 1 ? 'zuishangbu' : 'sousuo')+'" id="open_search" href="javascript:void(0);">'+(is_open == 1 ? '收起' : '搜索')+'</a>');
    $("#open_search").click(function(){
        var search_box = $(".admin_search_section");
        if(search_box.is(':hidden')){
            search_box.slideDown();
            $(this).html('收起');
            $(this).removeClass('iconfont-sousuo').addClass('iconfont-zuishangbu');
        }else{
            search_box.slideUp();
            $(this).removeClass('iconfont-zuishangbu').addClass('iconfont-sousuo');
            $(this).html('搜索');
        }
        
    });
    
    $("form[name='search']").submit(function(){
        var url = '{$searchConfig.searchPostUrl}';
        var data = $("form[name='search']").serialize();
        var send_data ={
            url:url,
            type:'GET',
            data:data,// 要提交的表单
        };
        //显示加载
        var setTimeId = setTimeout(function(){
            $(".loading_area").fadeIn();
        },600);
        send_ajax(send_data,function(res){
            clearTimeout(setTimeId);
            $(".loading_area").fadeOut();
            if(res === false){
                DEBUG && admin.log(ajax_error);
                return false;
            }
            if(res){
        		$(".content .rt_content").html(res); //load new content inside .mCSB_container
            }
            $(".content #mCSB_2_container").animate({"top":0});
            admin.lastGetUrl = url+'?'+data;
            return true;
        });
        return false;
    });
    
})
</script>